home *** CD-ROM | disk | FTP | other *** search
- Path: ix.netcom.com!netnews
- From: miker3@ix.netcom.com (Mike Rubenstein)
- Newsgroups: comp.lang.c++
- Subject: Re: pInt = new int [987654321L], what will happen ?
- Date: Sun, 04 Feb 1996 08:30:35 GMT
- Organization: Netcom
- Message-ID: <31146e4c.197257088@nntp.ix.netcom.com>
- References: <Pine.SOL.3.91.960203215559.25805E-100000@hamlet.uncg.edu>
- NNTP-Posting-Host: ix-dc6-02.ix.netcom.com
- X-NETCOM-Date: Sun Feb 04 12:30:09 AM PST 1996
- X-Newsreader: Forte Agent .99c/16.141
-
- "QIAN . ZHONG" <q_zhong@hamlet.uncg.edu> wrote:
-
- >
- > Hi, folks:
- >
- > Here is a question about new, the following is my code:
- >
- > int main(void)
- > {
- > int *pInt;
- > long Block = 987654321L;
- >
- > pInt = new int[Block];
- > if(pInt == NULL) dosomething();
- > }
- >
- > My problem is when I compile the program for DOS under large memory
- > model, above new nerve return NULL, I guess compiler convert
- >
- > new int[987654321L] --- convert --> new int[ ACONST]
- > where ACONST = 0xffff , or ACONST = 0x7fff, am I right ?
- > Is this a DOS thing ? or a C++ thing ? Is this portable ?
-
- More likely the system just doesn't have 987 meg free memory, so it
- can't do the allocation. Newer compilers will throw an exception, but
- older ones simply return the null pointer.
-
-
- Michael M Rubenstein
-